package com.clstu.homeworks;

import com.sun.xml.internal.ws.api.model.wsdl.WSDLOutput;

public class Homework03 {
    public static void main(String[] args) {
        Employee jack = new Worker("jack", 300, 30);//向上转型，没有特有方法所以不用再向下转型
        Employee frank = new Manager("Frank", 500, 28);
        jack.say();
        frank.say();
    }
}
class Employee{
    private String name;
    private double salary;
    private double grade=0.0;
    private int workday;

    public Employee(String name, double salary, int workday) {
        this.name = name;
        this.salary = salary;
        this.workday=workday;
    }

    public double getGrade() {
        return grade;
    }

    public void setGrade(double grade) {
        this.grade = grade;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    public double getSalary(){
        return salary;
    }
    public void setSalary(double salary) {
        this.salary = salary;
    }

    public int getWorkday() {
        return workday;
    }

    public void setWorkday(int workday) {
        this.workday = workday;
    }

    public double getmoney(){
        return getGrade()*getWorkday()*getSalary();
    }

    public void say(){
        System.out.println("我是 "+name+"，工资： "+getmoney());
    }
}

class Worker extends Employee{
    public Worker(String name, double salary, int workday) {
        super(name, salary, workday);
        setGrade(1);
    }

    @Override
    public double getmoney() {
        return super.getmoney();
    }
}

class Manager extends  Employee{
    private  double bonus=1000;
    public Manager(String name, double salary, int workday) {
        super(name, salary, workday);
        setGrade(1.5);
    }

    @Override
    public double getmoney() {
        return super.getmoney()+bonus;
    }
}